package com.kede.ienum;

import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/***
 ** @Author:Pr.li
 ** @Description: 商品类型: 0=实物商品,1=虚拟商品,2=积分
 ** @Date: create in 2023/5/15 22:34
 ***/
@Getter
@AllArgsConstructor
public enum GoodTypeEnum {
    ENTITY(0,"实物",1),
    VIRTUAL(1,"虚拟",2),
    SCORE(2,"德币",3);
    @EnumValue
    private Integer code;
    private String value;
    private Integer enumIndex;


    public static GoodTypeEnum parse(Integer code) {
        for (GoodTypeEnum value : values()) {
            if (value.code.equals(code)) {
                return value;
            }
        }
        return null;
    }
}
